
import {
    Service
} from "./request";

const urlData: object = {
    // 用户
    login: "login/",
    findSelf: "find_self/",
    editPassword: "edit_password/",
    
    // 增删查改 
    create: "create/",
    delete: "delete/",
    edit: "edit/",
    search: "search/",
    export: "export/",
    confirmEvent:"confirm_event/",
    review:"review/",
    syncTime:"sync_time/"



    // userSearchOrganization: "user/search_organization/",
    // userSearchUser: "user/search_user/",
    // userCreate: "user/create/",
    // userEdit: "user/edit/",
    // userDelete: "user/delete/",
    // editPassword: "user/edit_password/",
    // userSearchUserLog:"user/search_user_log/",

    // 站点维护
    // dataMaintainCreateMaintain: "data_maintain/create_maintain/",

    // dataMaintainSearchStationMaintain: "data_maintain/search_station_maintain/",
    // dataMaintainEditStationMaintain: "data_maintain/edit_station_maintain/",
    // dataMaintainDeleteStationMaintain: "data_maintain/delete_station_maintain/",
    // dataMaintainExportStationMaintain: "data_maintain/export_station_maintain/",

    // 隔直维护
    // dataMaintainCreateStraightMaintain: "data_maintain/create_straight_maintain/",
    // 统计查询

}
const downloadBoldList = [""]
export const $Http = (url: string, paramsData?: object) => {

    const http: object = {
        method: "post",
        url: urlData[url],
        responseType: downloadBoldList.includes(url) && "arraybuffer"
    }
    http["data"] = paramsData

    if (["create","edit","delete","review","confirmEvent"].includes(url) ) {
        http["data"]["alterID"] = sessionStorage.userID
        http["data"]["alterName"] = sessionStorage.username
        http["data"]["alterPower"] = sessionStorage.power
    }
    return Service(
        http
    )
}



